//
//  DeviceView.h
//  GKBHouse
//
//  Created by  on 12-6-21.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "LightController.h"
#import "ACController.h"
#import "DrapesController.h"
#import "DVDController.h"
#import "TVController.h"
#import "NewEquipment.h"
#import "MUSICController.h"
#define kIconWidth  45
#define kIconHeight 45

#define kIconBetween 13

#define kTextHeight 20

#define kViewWidth  (kIconWidth + kIconBetween*2)
#define kViewHeight kHouseMenuHeight //(kIconHeight + kTextHeight)

#define kTextWidth kViewWidth

#define kStateON  @"1"
#define kStateOFF @"2"

#define kNORegulate  @"0"
#define kCanRegulate @"1"

typedef enum
{
    DeviceTypeLight = 1, // 照明
    DeviceTypeAC = 2, // 空调
    DeviceTypeTV = 3, // 电视
    DeviceTypeDVD = 4 , // 音响
    DeviceTypeDrapes = 5, // 窗帘
    DeviceTypeSwitchAir = 6, // 排气
    DeviceTypeWater = 7, // 喷水
    DeviceTypeOther = 8, // 其他
    DeviceTypeProtect = 9, // 安防
    DeviceTypeMusic = 10, // 背景音乐
    
    DeviceTypeDecode = 11,  // 解码器
    DeviceTypeNewCloud = 12, // 新风系统
    DeviceTypeVideo,
    DeviceTypeArea,
    DeviceTypeBed = 20, // 翻板床
    DeviceTypeXClothStand = 21, // 旋转衣架
    DeviceTypeCloth = 22, // 衣柜
    DeviceTypeTTM = 23, // 榻榻米
    DeviceTypeShoes = 24, // 鞋柜
    DeviceTypeCClothStand = 25, // 凉衣架
    
    DeviceTypeScene,
    DeviceTypeAll,
    
    
}DeviceType;


@interface DeviceView : UIView
@property (nonatomic, retain) UIButton *button;
@property (nonatomic, retain) UILabel *title;
@property (nonatomic, assign) DeviceType type;
@property (retain) NewEquipment *equipment;
@property (assign) BOOL Switch;
@property (retain) UIViewController *viewController;
@property (nonatomic, strong) NSString *oldname;
@property (nonatomic, strong) NSString *oldpasswd;
@property (nonatomic, strong) NSString *sessionIds;
@property (nonatomic, strong) NSString *hostnum;

- (id)initWithFrame:(CGRect)frame withEqu:(NewEquipment *)equ;
- (void)setDeviceOn:(BOOL)on;

+ (void)setDeivceOnOff:(NewEquipment *)euq button:(UIButton *)OnOff State:(BOOL)on;
+ (NSString *)deviceName:(DeviceType)dType;
+ (NSString *)deviceImageName:(DeviceType)dType;
- (BOOL)NORegulate;
//情景打开
- (void)openScene;
- (void)openSceneEnd:(NSDictionary *)dic;
- (void)setScene;
//关闭情景
- (void)closeScene;
- (void)closeSceneEnd:(NSDictionary *)dic;
- (void)setCloseScene;
//全关
- (void)allOnOffAction;
- (void)allOnOffActionEnd:(NSDictionary *)dic;
- (void)turnOffAll;
+ (BOOL)deviceStateOn:(NewEquipment *)equ;
- (void)updateEquipmentState;
#pragma mark - 电器设备开关状态
- (void)ctlDeviceEnd:(NSDictionary *)dic;

+ (void)ctlDeviceSwithcId:(NSString *)swId name:(NSString *)name OnOff:(BOOL)open target:(id)target end:(SEL)action;
//提示，操作：xxx, 
+ (void)OperatSwithcId:(NSString *)swId name:(NSString *)name OnOff:(BOOL)open target:(id)target end:(SEL)action;
+ (void)ctlDevice:(NewEquipment *)equ target:(id)target end:(SEL)action;
//+ (BOOL)ctlDeviceEnd:(Equipment *)equ;
//+ (BOOL)ctlDeviceEnd:(Equipment *)equ result:(BOOL)result;
+ (NSString *)ctlDeviceStr:(BOOL)on name:(NSString *)name;
+ (NSString *)ctlDeviceEndTipStr:(BOOL)on name:(NSString *)name;
@end
